<?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

/* JoomLeague League Management and Prediction Game for Joomla!
 * Copyright (C) 2007  Robert Moss
 *  
 * Homepage: http://www.joomleague.de
 * Support: htt://www.joomleague.de/forum/
 * 
 * This file is part of JoomLeague.
 *  
 * JoomLeague is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * Please note that the GPL states that any headers in files and
 * Copyright notices as well as credits in headers, source files
 * and output (screens, prints, etc.) can not be removed.
 * You can extend them with your own credits, though...
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 * The "GNU General Public License" (GPL) is available at
 * http://www.gnu.org/copyleft/gpl.html.
*/ 

class JL_nav {
function project_dropdown (&$ausgabehtml, &$params, $project_id, $JLItemid) {
	global $database;
	$pselect=$ausgabehtml['menupunktbeginn'];
	$menuurl="index.php?option=com_joomleague&amp;func=$params->project_start&amp;Itemid=$JLItemid&amp;p=";
	$selectoptions[]= mosHTML::makeOption('', $params->text_project_dropdown);
	$query="SELECT id, name FROM #__joomleague WHERE published=1 ORDER BY name";
	$database->setQuery($query);
	$rows = $database->loadObjectList();
	foreach ($rows AS $row)
	{
		$thismenuurl='';
		if ($params->stringlength) $selecttext=substr($row->name,0,$params->stringlength)."...";
		else $selecttext=$row->name;
//		$thismenuurl=sefRelToAbs($menuurl.$row->id);
		$thismenuurl=($menuurl.$row->id);
if ($row->id==$project_id) $selectedoptionsvalue=$thismenuurl; 
		$selectoptions[] = mosHTML::makeOption($thismenuurl, $selecttext);
	}
	$projectlist = mosHTML::selectList( $selectoptions, 'jl_p', "class=\"inputbox\" onchange=\"javascript:if (this.options[this.options.selectedIndex].value!='') gotoproject(this.options[this.options.selectedIndex].value);\" style=\"font-size:9px;\"",'value', 'text', $selectedoptionsvalue );
		$pselect.=$projectlist.$ausgabehtml['menupunktende'];
	echo $pselect;
}
function makeJLnavlinks (&$ausgabehtml, $menuclass, $what, $linklabel, &$joomleague, $params, $JLItemid, $jl_func) {
	global $mainframe, $database;
	$teamlist='';
	$selectoptions=array();
	if ($what=="seperator")
  {
		$linktext = $ausgabehtml['menupunktbeginn'].$linklabel.$ausgabehtml['menupunktende'];
	}
	else
	{
		$linktext= $ausgabehtml['menupunktbeginn'].'<a href="';

        if ($params->custom_item_id=='') {
       	   $query="SELECT id FROM #__menu WHERE link LIKE 'index.php?option=com_joomleague%' AND link LIKE '%&func=$what%' AND link LIKE '%&p=".$joomleague->id."%' LIMIT 1";
           $database->setQuery($query);
           $JavaItemid = $database->loadResult();
        } else $JavaItemid=$params->custom_item_id;
                    
		$linktextsef = 'index.php?option=com_joomleague&amp;func='.$what.'&amp;p='.$joomleague->id.'&amp;Itemid='.$JavaItemid;
		$linktext .= sefRelToAbs($linktextsef);
		$linktext .='" class="'.$menuclass.'"';
		if($what==$jl_func)
		{
			$linktext.= ' id="active_menu"';
			if ($linklabel!="") $mainframe->appendPathWay($linklabel);
		}
		$linktext.= '>';
		$linktext.= $linklabel;
		$linktext.= '</a>'.$ausgabehtml['menupunktende'];
		
	}
	echo $linktext;
}
}
?>
